package com.itbz.encFile;


import javax.servlet.*;
import java.io.IOException;

public class EncFile implements Filter {
    private String enc;
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        enc = filterConfig.getInitParameter("enc");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        request.setCharacterEncoding(enc);
        response.setContentType("text/html;charset="+enc);
        chain.doFilter(request,response);
    }

    @Override
    public void destroy() {

    }
}
